﻿@model projectManagementWeb.Models.Developer.TaskListModel
           
@{
    ViewBag.Title = "DeveloperTasksForm";
}

    <p align="right">
        @Html.ActionLink("<< Regresar", "Index")
    </p>


<fieldset>

    <legend>Bienvenido</legend>
    <h1>@User.Identity.Name</h1>

    @{
        
    projectManagementWeb.Controllers.DeveloperController controlLayer = new projectManagementWeb.Controllers.DeveloperController();
    projectManagementWeb.Models.Developer.UserDataModel userData = controlLayer.GetUserData(@User.Identity.Name);
    <h2>@userData.UserCompleteName</h2>
    <h2>@userData.UserMail</h2>
    
   }


</fieldset>

<fieldset>

   

@using (Html.BeginForm("DeveloperTasksForm", "Developer", FormMethod.Post))
{
    
    @Html.ValidationSummary(true)
     <legend>Lista de Tareas</legend>
    <p>
           <input type="submit" value="Guardar"/>
    </p>
     @Html.ValidationMessageFor(model => model.taskList)
    <table>

        <tr>
         <td> 
         ID
          </td>
         <td>
         Tarea
         </td>
         <td>
         Inicio
         </td>
         <td>
         Final
         </td>
         <td>
         Duración
         </td>
         <td>
         Esfuerzo Invertido
         </td>
         <td>
         Esfuerzo Faltante
         </td>
         <td>
         Estatus
         </td>
         <td>
         Módulo
         </td>
          <td>
         Proyecto
         </td>
        </tr>
        @if (Model.taskList != null)
        {
            for (int i = 0; i < Model.taskList.Count; i++)
            {
            @Html.HiddenFor(model => model.taskList[i].TaskDescription);
            @Html.HiddenFor(model => model.taskList[i].StartDate);
            @Html.HiddenFor(model => model.taskList[i].EndDate);
            @Html.HiddenFor(model => model.taskList[i].TaskName);
                                                                       
        <tr>
         <td>
         @Html.TextBoxFor(model => model.taskList[i].TaskID, new { @readonly = "readonly", style = "width:50px;" })
          </td>
         <td>
         @Html.ActionLink(Model.taskList[i].TaskName, "TaskDescription", new { taskID = Model.taskList[i].TaskID }, null)
         </td>
         <td>
         @Model.taskList[i].StartDate.ToShortDateString()
         <!--@Html.DisplayTextFor(model => model.taskList[i].StartDate.Date)-->
         </td>
         <td>
         @Model.taskList[i].EndDate.ToShortDateString()
         <!--@Html.DisplayTextFor(model => model.taskList[i].EndDate.Date)-->
         </td>
         <td>
         @Html.TextBoxFor(model => model.taskList[i].PlannedEstimate, new { @readonly = "readonly", style = "width:50px;" })
         </td>
         <td>
          <div class="editor-field">
            @Html.TextBoxFor(model => model.taskList[i].CurrentEffortDone, new { style = "width:50px;" })
            @Html.ValidationMessageFor(model => model.taskList[i].CurrentEffortDone)
           </div>
         </td>
         <td>
         @Html.TextBoxFor(model => model.taskList[i].CurrentEffortPending, new { style = "width:50px;" })
         @Html.ValidationMessageFor(model => model.taskList[i].CurrentEffortPending)
         </td>
         <td>
         @{
                                                                var selectList = new SelectList(Model.StatusList, "Value", "Text", Model.taskList[i].CurrentStatus);
        }
        @Html.DropDownListFor(model => model.taskList[i].CurrentStatus, selectList)
         </td>
         <td>
         @Html.TextBoxFor(model => model.taskList[i].ModuleName, new { @readonly = "readonly", style = "width:100px;" })
         </td>
          <td>
          @Html.TextBoxFor(model => model.taskList[i].ProjectName, new { @readonly = "readonly", style = "width:150px;" })
         </td>

        </tr>
            }
        }         
    </table>
        
}
</fieldset>